<template>
    <div class="good-item-div">
        <div style="width: 100%;height: 15px;clear: both;"></div>
        <div class="good-item">
            <img @click="showDetail" :src="good.logoImg">
            <div class="good-item-right">
                <div class="good-name">
                    <span style="margin-right: 10px;">{{ good.goodName }}</span>
                </div>
                <div class="commission-rule">
                    <div class="down-tgt" @click="showCommitOrderUrl">立即推广</div>
                    <div class="commission-val" style="margin-right: 10px;" v-if="id">佣金{{ good.xiaJiActiveCommission ?
                        good.xiaJiActiveCommission
                        : '0'
                    }}元</div>
                    <div class="commission-val" style="margin-right: 10px;" v-else>佣金{{ good.selfActiveCommission ?
                        good.selfActiveCommission
                        : '0'
                    }}元</div>
                </div>
            </div>
        </div>
        <div style="width: 100%;height: 15px;clear: both;"></div>
        <div style="width: 100%;height: 1px;border-bottom: 1px solid #eee;width: 94%;margin-left: 3%;"></div>
    </div>
</template>

<script>
import { showToast } from 'vant';
export default {
    name: "GoodItem",
    props: {
        good: Object
    },
    created() {
        this.user = this.$store.state.seller
        this.id = this.$route.query.id
        console.info("id=", this.id)
    },
    data() {
        return {
            goodTag: [],
            commissionRule: "",
            commissionRuleDlalog: false,
            form: {},
            user: null
        }
    },
    methods: {
        showCommitOrderUrl() {
            if (this.user) {
                this.$emit("showCommitOrderUrl", this.good)
            } else {
                if (this.id) {
                    localStorage.setItem("sellerTJID", this.id)
                }
            }
        },
        showDetail() {
            this.$router.push({
                path: "/seller/good/detail", query: { id: this.good.id }
            })
        },
        restGoodPageData() {
            this.$emit("restGoodPageData")
        }
    }
}
</script>
<style scoped>
.good-item-div {
    width: 100%;
    background-color: white;
    overflow: hidden;
}

.good-item {
    width: 94%;
    margin-left: 3%;
}

.good-item img {
    width: 100px;
    height: 100px;
    float: left;
    margin-right: 10px;
    border-radius: 5px;
}

.good-item .good-name {
    color: #3F3F3F;
    font-size: 15px;
    line-height: 20px;
    font-weight: bold;
    height: 60px;
    overflow: hidden;
}

.commission-rule {
    margin-top: 10px;
    height: 30px;
}

.miao-fan {
    background-color: #E5F0FF;
    border-radius: 14px;
    color: #116FF0;
    font-size: 13px;
    padding: 5px 10px;
}

.down-tgt {
    background: linear-gradient(to right, #E4EEFF 10%, #AECDFF 90%);
    border-radius: 15px;
    color: #4089FF;
    font-size: 12px;
    width: 80px;
    height: 30px;
    float: left;
    line-height: 30px;
    text-align: center;
}

.commission-val {
    float: right;
    height: 30px;
    line-height: 30px;
    font-size: 15px;
    color: #FF2728;
}
</style>